package com.cn.aam.checaiduo.ui.me.command;


import com.cn.aam.checaiduo.AppData;
import com.cn.aam.checaiduo.backend.RetrofitHome;
import com.cn.aam.checaiduo.backend.observer.OnRequestListV2Listener;
import com.cn.aam.checaiduo.backend.rx.RxSchedulers;
import com.cn.aam.checaiduo.backend.CommandV2;
import com.cn.aam.checaiduo.bean.me.InvestRecordB;
import com.cn.aam.checaiduo.bean.base.PageB;

/**
 * monker on 2017/5/27.
 */

public class InvestRecordCommand extends CommandV2<InvestRecordB> {

    String startDate;
    String endDate;
    String type;

    public InvestRecordCommand(String startDate, String endDate, String type) {
        this.startDate = startDate;
        this.endDate = endDate;
        this.type = type;
    }

    public void setData(String startDate, String endDate) {
        this.startDate = startDate;
        this.endDate = endDate;
    }


    @Override
    public void execute(String pageNumber, String pageSize, OnRequestListV2Listener<InvestRecordB> observer) {
        RetrofitHome.getInstance()
                .getInternalApi()
                .getInvestList(pageNumber + "", pageSize + "", startDate, endDate, type, AppData.getToken())
                .compose(RxSchedulers.<PageB<InvestRecordB>>toMain())
                .subscribe(observer);
    }
}
